BACKUP_FILES=Makefile README.txt dummyfs.c fs.c fs.h fsshell.c \
				 fsshell.strings mksimdisk.c simdisk.c simdisk.h
COMPILE_FILES=fs.c fsshell.c simdisk.h simdisk.c
PACK_FILES=$(BACKUP_FILES)
PACK_PREFIX=Pelle_o_Olle_DAB720_Labb3
PROGRAM_NAME=fsshell
SIMDISK_FILENAME=mydisk.sd

DEFINES=-DINVERT_LONG_LS -DUSE_COLORS

all:
	######################################################################
	##                                                                  ##
	##                           COMPILING....                          ##
	##                                                                  ##
	######################################################################

	gcc $(DEFINES) $(EXTRACREDIT) -o $(PROGRAM_NAME) $(COMPILE_FILES)

run:
	$(PROGRAM_NAME)

dummy:
	gcc $(DEFINES) -o dumb dummyfs.c fsshell.c

simdisk:
	gcc -o mksimdisk simdisk.c mksimdisk.c
	mksimdisk $(SIMDISK_FILENAME) 64 256

clean:
	rm -f $(PROGRAM_NAME) $(PACK_PREFIX).tar.gz $(SIMDISK_FILENAME) mksimdisk dumb

pack:
	mkdir $(PACK_PREFIX)
	cp $(PACK_FILES) $(PACK_PREFIX)
	tar cf $(PACK_PREFIX).tar $(PACK_PREFIX)
	gzip $(PACK_PREFIX).tar
	rm -rf $(PACK_PREFIX)

backup:
	mkdir -p backups
	tar cf BACKUP_$(shell date | sed 's/[ ,:]/_/g').tar $(BACKUP_FILES)
	gzip BACKUP_*.tar
	mv BACKUP_*.tar.gz backups

test:	run
